<#assign menu="singlePage">
<#assign submenu="add_singlePage">
<#include "/system/head.ftl">
<style type="text/css">
.m-bot15 {
    margin-bottom: 5px;
}
.form-control {
    border: 1px solid #E2E2E4;
    box-shadow: none;
    color: #C2C2C2;
}
.input-lg {
    border-radius: 6px;
    font-size: 15px;
    height: 40px;
    line-height: 1.33;
    padding: 9px 15px；
}

</style>
		<!--main content start-->
		<section id="main-content">
			<section class="wrapper">
              <!-- page start-->
              <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                            	 添加单页
                          </header>
                          <div class="panel-body">
                              <form id="add_singlePageEntity_form" method="post" class="form-horizontal" autocomplete="off" action="${basePath}/admin/singlePage/addNew.json">
                              	<fieldset>
                                  <div class="form-group">
                                      <label class="col-sm-2 col-sm-2 control-label">名称</label>
                                      <div class="col-sm-10">
                                          <input type="text" class="form-control" name="singlePageEntity.title"
                                          	placeholder="名称" id="title" value="<#if title??>${title}</#if>">
                                      </div>
                                  </div>
                                  <div class="form-group">
			                          <label class="col-sm-2 col-sm-2 control-label">所属栏目</label>
			                          <div class="col-sm-10">
			                              <select class="form-control" id="classId" name="singlePageEntity.classId" style="font-size:15px;width: 300px;">
						                   		<#list classesList as classes>
						                   			<option style="background-color:#DFF0D8;font-weight:bold;" value="${classes.id}" selected>${classes.name}</option>
						                   		</#list>						
				                            </select>			
			                          </div>
			                        </div>  
                                   <div class="form-group">
			                              <label class="col-sm-2 col-sm-2 control-label">文章内容</label>
			                              <div class="col-sm-10">
			                                  <script id="content" name="content" type="text/plain"
													style="width: 100%; height: 260px;"></script>
											  <script type="text/javascript">
												var contentEditor;
												$(function() {
													contentEditor = UE.getEditor('content');
												});
											  </script>
			                              </div>
			                        </div>
                                  <div class="form-group">
                                  	<label class="col-sm-2 col-sm-2 control-label"></label>
                                      <button class="btn btn-danger" type="submit">增加</button>
                                  </div>
                                 </fieldset>
                              </form>
                          </div>
                      </section>
                  </div>
              </div>
              <!-- page end-->
          </section>
		</section>
		<!--main content end-->
<script type="text/javascript">
	$(function() {
		$('#add_singlePageEntity_form').ajaxForm({
			dataType : 'json',
			success : function(data) {
				if (data.result) {
					bootbox.alert("保存成功，将刷新页面", function() {
						window.location.reload();
					});
				}else{
					showErrors($('#add_singlePageEntity_form'),data.errors);
				}
			},
			error:function(data,textstatus){
		        bootbox.alert({  
		            buttons: {  
		               ok: {  
		                    label: '关闭'
		               }  
		            },
		            message: data.responseText,
		            title: '<@spring.message "system.errorTip"/>',  
		        });
	        }  
		});
	});
</script>
<#include "/system/foot.ftl">
